import '@testing-library/jest-dom';

// Jest测试环境的uni mock
declare global {
  var uni: {
    request: jest.MockedFunction<any>;
    getSystemInfo: jest.MockedFunction<any>;
    getNetworkType: jest.MockedFunction<any>;
    getStorageSync: jest.MockedFunction<any>;
    setStorageSync: jest.MockedFunction<any>;
    removeStorageSync: jest.MockedFunction<any>;
    switchTab: jest.MockedFunction<any>;
    navigateTo: jest.MockedFunction<any>;
    redirectTo: jest.MockedFunction<any>;
  };
  
  var getCurrentPages: jest.MockedFunction<() => Array<{ route: string }>>;
}

// Mock uni对象
global.uni = {
  request: jest.fn(),
  getSystemInfo: jest.fn(),
  getNetworkType: jest.fn(),
  getStorageSync: jest.fn(),
  setStorageSync: jest.fn(),
  removeStorageSync: jest.fn(),
  switchTab: jest.fn(),
  navigateTo: jest.fn(),
  redirectTo: jest.fn(),
};

global.getCurrentPages = jest.fn(() => [{ route: 'pages/index/index' }]);